class Operacao {
        //ORM
	static hasMany = [ cheques : Cheque, taxas : Taxa ]
        static transients = ['quantidadeCheques', 'valorTotal', 'valorTotalLiquido']
        
        //validation
        static constraints = {
		cliente(nullable:false)
		fator(nullable:false)
		dataOperacao(nullable:false)
	}
	
	
	
	Cliente cliente
	Calendar dataOperacao
	Double fator
	
	public int getQuantidadeCheques(){
		return cheques.size()
	}
	
	public Double getValorTotal(){
		double total = 0.0;
		cheques.each{
			total += it.valor
		}
		return total
	}
        
        public Double getValorTotalLiquido(){
		double total = getValorTotal()
                taxas.each{
                    total -= it.taxValue(getValorTotal())
                }   
		return total
	}
	
	
	
	

}
